#ifndef ADDAO
#define ADDAO
#define AD_DB_PATH "/home/vm/CC_ads/ads.db"

typedef struct AdResource
{
    int id;
    int ad_id;
    int type_id;
    char* path;
    char* sign;
    int index;
}AdResource;

typedef struct Ad
{
    int id;
    int template_id;
    int customer_id;
    char* start_time;
    char* end_time;
    int state;
    int index;

    //广告源
    AdResource* resources[3];
}Ad;

int saveAd(Ad* ad);
int updateAd(Ad* ad);
Ad* getAd(int id);

int saveAr(AdResource* ar);
int updateAr(AdResource* ar);
AdResource* getAr(int adid,int index);

int clearExpireAd();

#endif